<?php
// dashboard.php

session_start();

// 检查用户是否已登录
if (!isset($_SESSION['user_id'])) {
    header('Location: index.php');
    exit();
}

$username = $_SESSION['username'];
$user_id = $_SESSION['user_id'];
?>

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户中心</title>
    <link rel="stylesheet" href="//dev.dcloud.net.cn/mui/dist/css/mui.min.css">
    <style>
        .mui-content {
            padding: 20px;
        }
        .mui-card {
            margin-top: 20px;
            width: 50%;
            margin: 0 auto;
        }
        .mui-btn {
            margin-top: 20px;
        }
        .mui-card-content{
            padding-left: 15px;
        }
    </style>
</head>
<body>
    <div class="mui-content">
        <div class="mui-card"  style="width:75%">
            <div class="mui-card-header">欢迎, <?php echo htmlspecialchars($username); ?></div>
            <div class="mui-card-content">
                <p>用户ID: <?php echo htmlspecialchars($user_id); ?></p>
            </div>
            <div class="mui-card-footer">
                <a href="logout.php" class="mui-btn mui-btn-danger">注销登录</a>
            </div>
        </div>
    </div>
</body>
</html>
